const Koa = require('koa');
// const Router = require('koa-router');

// const requireDirectory = require('require-directory'); // 引入requireDirectory 用于获取路由文件
const parser = require('koa-bodyparser');
const InitManager = require('./core/init');
const app = new Koa();
const catchError = require('./middlewares/exception');

app.use(catchError);
app.use(parser());

InitManager.initCore(app);
// requireDirectory(module, './apiStudy/v1', { visit: whenLoadModule });

// function whenLoadModule (obj) {
//   if (obj instanceof Router) {
//     app.use(obj.routes());
//   }
// }


app.listen(3000);

